#include<iostream>
#include<string>
#include<vector>
using namespace std;
class Solution
{
public:

    string formatString(string str, vector<char>& arg)
    {
        int i = 0, j = 0;
        for (; i < str.size() && j < arg.size(); i++)
        {
            if (str[i] == '%')
            {
                str[i] = arg[j++];
                str.erase(i + 1, 1);
            }
        }
        while (j < arg.size())
        {
            str += arg[j++];
        }
        return str;
    }
};

int main()
{
    Solution s;
    string str = "A%sC%sE";
    vector<char> arg{ 'B','D','F' };
    string sst = s.formatString(str, arg);
    cout << sst << endl;
}

